-
Notifications
You must be signed in to change notification settings - Fork 12.3k
Move multiproof hashes allocation under condition to avoid zero-length alloc #6092
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Move multiproof hashes allocation under condition to avoid zero-length alloc #6092
Conversation
|
WalkthroughCode blocks handling hashes array initialization and the main per-proof loop processing in MerkleProof functions have been refactored to execute conditionally. These operations are now placed inside the Pre-merge checks and finishing touches✅ Passed checks (3 passed)
✨ Finishing touches🧪 Generate unit tests (beta)
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (9)
🔇 Additional comments (4)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
ernestognw
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. We'll need a second review here
This change relocates the allocation of the temporary hashes array and related counters inside the if (proofFlagsLen > 0) branch across all four multiproof functions in MerkleProof.sol. When proofFlagsLen == 0, the function returns early and hashes is never used; previously this still incurred an unnecessary zero-length memory allocation and variable initialization. The refactor avoids that overhead without changing semantics, consistent with existing docs and tests.